class HomeController {

	def index = { 
		//[ bookList: Book.findAll() ]
		[  bookList: Book.listBooksAvailableToRent() ]
	}

        def search = {
		if(!params.q)
			render(view:"/home/index", model:[ bookList: Book.listBooksAvailableToRent() ])
		else 
			render(view:"/home/index", model:[ bookList: Book.findAllByTitleLike("%"+params.q+"%") ])
    	}

}
